<template>
	<view class="container">
		<view class="top">
			<view class="title">{{title}}</view>
			<view class="right">{{list.length}}个系列</view>
		</view>
		
		<view class="list">
			<view class="item" v-for="item in list" @click="toDetail(item.id,item.title)">
				<image class="img" :src="item.thumb" mode="aspectFill"></image>
				<view class="t">{{item.title}}</view>
				<view class="num">
					<text class="one">{{item.num}}</text>
					<text class="two">/{{item.all_num}}</text>
				</view>
			</view>
			<view class="noData">
				<NoData v-if="!list.length" title="暂时还木有图鉴"></NoData>
			</view>
			
		</view>
	</view>
</template>

<script>
	import {
		mapGetters
	} from "vuex"
	export default {
		data() {
			return {
				id:0,
				list:[],
				title:''
			}
		},
		computed: {
			...mapGetters(["userInfo"]),
		},
		watch: {
		},
		onLoad(e) {
			this.id = e.id;
			this.title = e.title;
			this.getList()
		},
		methods: {
			toDetail(id,title){
				uni.navigateTo({
					url:'/pages/collection/detail?id='+id+'&title='+title
				})
			},
			getList(){
				this.$http('/activity/activityList/'+this.userInfo.uuid, 'GET', {
					category_id: this.id,
				}).then(res => {
					this.list = res.data.list
				})
			}
		}
	}
</script>

<style lang="scss">
	page{
		background: #f3f3f3;
	}
	.top{
		padding: 35rpx 30rpx 20rpx 30rpx;
		display: flex;
		justify-content: space-between;
		.title{
			font-family: alimama;
			font-size: 36rpx;
		}
		.right{
			font-family: youshe;
			font-size: 30rpx;
		}
		
	}
	
	.list{
		padding: 0rpx 30rpx;
		font-family: alimama;
		display: flex;
		// justify-content: space-around;
		flex-wrap: wrap;
		box-sizing: border-box;
		padding-bottom: 30rpx;
		.noData{
			margin: 0 auto;
		}
		.item{
			width: 335rpx;
			background-color: #fff;
			border-radius: 10rpx;
			height: 500rpx;
			box-sizing: border-box;
			margin-top: 15rpx;
			.t{
				font-size: 26rpx;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 1;
				-webkit-box-orient: vertical;
				width: 320rpx;
				margin-top: 15rpx;
				margin-left: 10rpx;
			}
			.num{
				font-family: youshe;
				margin-left: 10rpx;
				padding-bottom: 10rpx;
				.one{
					font-size: 40rpx;
				}
			}
			.img{
				width: 340rpx;
				height: 400rpx;
				border-top-right-radius: 10rpx;
				border-top-left-radius: 10rpx;
			}
		}
		.item:nth-child(2n-1){
			margin-right: 15rpx;
		}
	}
</style>
